#ifndef MYAPPLICATION_H
#define MYAPPLICATION_H

#include <QObject>
#include <QGuiApplication>
#include "ThrumasterPusher.h"
#include "ThrumasterRocker.h"

class MyApplication: public QGuiApplication
{
    Q_OBJECT
public:
    MyApplication(int &argc
                  , char **argv
                  , ThrumasterPusherThread *thrumasterPusherThread
                  , ThrumasterRockerThread *thrumasterRockerThread)
        :QGuiApplication(argc, argv)
        , m_thrumasterPusherThread(thrumasterPusherThread)
        , m_thrumasterRockerThread(thrumasterRockerThread) {};

    ~MyApplication() {
        m_thrumasterPusherThread->requestInterruption();
        m_thrumasterRockerThread->requestInterruption();

        m_thrumasterPusherThread->quit();
        m_thrumasterRockerThread->quit();

        m_thrumasterPusherThread->wait();
        m_thrumasterRockerThread->wait();
    }

private:
    ThrumasterPusherThread* m_thrumasterPusherThread;
    ThrumasterRockerThread* m_thrumasterRockerThread;
};

#endif // MYAPPLICATION_H
